<?php

// No direct access

defined('_JEXEC') or die('Restricted access');

$css1 = JURI::base().'components/com_restoran/assets/css/common.css';

$document 	=& JFactory::getDocument();
$document->addScript('components/com_restoran/assets/js/livevalidation.js');
?>

<link rel="stylesheet" href=<?echo $css1 ?> type="text/css" media="screen" />
<form action="index.php?option=com_restoran&view=all" method="post" name="adminForm" id="adminForm">
<fieldset class="adminform">
<legend>Cari Semua Restoran</legend>
<table class="admintable">

<tr>
<td>
Masukkan Inputan :
</td>
<td width="100" align="right" class="key">
    <input name="field_cari" type="text" class="input" id="field_cari"/>
    <script type="text/javascript">
        var field_cari = new LiveValidation('field_cari');
        field_cari.add( Validate.Presence ,{ failureMessage: "Harus Diisi..!!" });
    </script>
</td>

<td>
<input name="cari" type="submit" value="search" class="button" />
</td>
</tr>
</table>

<?php
    if (($_POST[field_cari]&&!empty($this->xml[1][nama_rest]))||$this->input){
        if ($_POST[field_cari]){
            $namainput = $_POST[field_cari];
        }else{
            $namainput = $this->input;
        }
echo "hasil pencarian restauran yang ada di <strong>".$namainput."</strong>";
echo "<br/>";

for ($i=1, $n=count($this->xml),$j=1; $i < $n; $i=$i+2)
	{

?>
<div class="result">
<fieldset><legend><?echo "Restoran ".$j;?></legend>
<table border="0">
  <tr>
    <td colspan="6"><strong><?echo $this->xml[$i][nama_rest];?></strong></td>
  </tr>
  <tr>
    <td colspan="6"><strong><?echo $this->xml[$i][alamat_rest];?></strong></td>
  </tr>
  <tr>
    <td colspan="6"><strong><?echo $this->xml[$i][telp_rest];?></strong></td>
  </tr>
  <tr>
    <td colspan="6"><strong><?echo $this->xml[$i][website_rest];?></strong></td>
  </tr>
  <tr>
    <td colspan="3" align="center"><strong><u>MAKANAN</u></strong></td>
    <td colspan="3" align="center"><strong><u>MINUMAN</u></strong></td>
  </tr>
  <tr>
    <td colspan="1" width="317"><?echo $this->xml[$i][makanan_1];?></td>
	<td width="38">Rp</td>
    <td width="105"><?echo $this->xml[$i][harga_makanan_1 ];?></td>
    <td width="330"><?echo $this->xml[$i][minuman_1];?></td>
	<td width="42">Rp</td>
    <td width="113"><?echo $this->xml[$i][harga_minuman_1 ];?></td>
  </tr>
  <tr>
    <td width="317"><?echo $this->xml[$i][makanan_2];?></td>
	<td width="38">Rp</td>
    <td><?echo $this->xml[$i][harga_makanan_2 ];?></td>
    <td><?echo $this->xml[$i][minuman_2];?></td>
	<td width="42">Rp</td>
    <td><?echo $this->xml[$i][harga_minuman_2 ];?></td>
  </tr>
  <tr>
    <td width="317"><?echo $this->xml[$i][makanan_3];?></td>
	<td width="38">Rp</td>
    <td><?echo $this->xml[$i][harga_makanan_3 ];?></td>
    <td><?echo $this->xml[$i][minuman_3];?></td>
	<td width="42">Rp</td>
    <td><?echo $this->xml[$i][harga_minuman_3 ];?></td>
  </tr>
  <tr>
    <td width="317"><?echo $this->xml[$i][makanan_4];?></td>
	<td width="38">Rp</td>
    <td><?echo $this->xml[$i][harga_makanan_4];?></td>
    <td><?echo $this->xml[$i][minuman_4];?></td>
	<td width="42">Rp</td>
    <td><?echo $this->xml[$i][harga_minuman_4 ];?></td>
  </tr>
  <tr>
    <td width="317"><?echo $this->xml[$i][makanan_5];?></td>
	<td width="38">Rp</td>
    <td><?echo $this->xml[$i][harga_makanan_5];?></td>
    <td><?echo $this->xml[$i][minuman_5];?></td>
	<td width="42">Rp</td>
    <td><?echo $this->xml[$i][harga_minuman_5 ];?></td>
  </tr>
  
</table>
</fieldset>
</div>
<?
echo "<br />";
$j++;
    }// end of for
  }// end of if

else if ($_POST[field_cari]&&empty($this->xml[1][nama_rest])) {
    echo "Hasil Pencarian Terhadap <strong>$_POST[field_cari]</strong> Tidak Menemukan Hasil";
    }
?>
</fieldset>
</form>